package com.roy.sms.vo;

import com.roy.sms.model.User;

public class UserVO {
	private int id;
	private String nickname;
	private String username;
	private String password;
	private int state;
	private String stateStr;
	
	public UserVO(){
	}
	
	public UserVO(User user){
		this.id = user.getId();
		this.nickname = user.getNickname();
		this.username = user.getUsername();
		this.password = user.getPassword();
		this.state = user.getState();
		setStateStr();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getStateStr() {
		return stateStr;
	}

	public void setStateStr(String stateStr) {
		this.stateStr = stateStr;
	}
	
	public void setStateStr(){
		if(state == User.STATE_ENABLE){
			stateStr = "启用";
		} else if(state == User.STATE_DISABLE){
			stateStr = "禁用";
		}
	}
	
	public User getUser(){
		User user = new User();
		user.setId(id);
		user.setNickname(nickname);
		user.setUsername(username);
		user.setPassword(password);
		user.setState(state);
		return user;
	}
	
}
